<template>
	<view class="apply" style="overflow: hidden;">
		<view class="applyTop">
			<view class="applytitle">浙江高信标准版</view>
		</view>
		<view class="pageText">
			<view class="pageTitle">
				<view class="personLogo">
					<image src="@/static/index/boy.png"></image>
				</view>
				<view class="userInfo">
					<view class="name">{{userInfo.realName}}</view>
					<view class="company">{{userInfo.companyName}}</view>
				</view>
			</view>
		</view>
		<view class="applyBody" style="margin-top: 68upx;">
			<swiper :current="tabIndex" class="swiper-boxs" :duration="300" @change="ontabchange">
				<swiper-item class="swiper-item" :key="0">
					<view class="module" v-for="(items,i) in outCheck" :key="i">
						<view class="itemTitle">{{items.title}}</view>
						<view style="display: flex;padding: 20upx 15upx;flex-wrap:wrap;">
							<view class="contentModule" v-for="(item,index) in items.lists" :key="index">

								<view @click="skipOperation(item.routerPath,index+1,item.url)" class="skipOpera">

									<view class="imgbox">
										<image :src="item.imgPath"></image>
										<view class="iconNum" v-if="item.num!=0">{{item.num}}</view>
									</view>
									<view class="title">
										<view>
											{{item.title}}
										</view>
									</view>
								</view>


							</view>
						</view>
					</view>


				</swiper-item>


			</swiper>
			<u-tabbar @change="change" height="100rpx" v-model="current" :show="show" :bg-color="bgColor"
				:border-top="borderTop" :list="list" :mid-button="midButton" :inactive-color="inactiveColor"
				:activeColor="activeColor" size="25px">
			</u-tabbar>
		</view>

	</view>
</template>
<script>
	import uTabbar from "@/uview-ui/components/u-tabbar/u-tabbar.vue"
	import nCollapse from "@/components/lun-collapse/lun-collapse.vue"
	export default {
		data() {
			return {
				tabIndex: 0,
				Wechat: null,
				userInfo: {},
				scrollInto: "",
				num: 10,
				role: null,
				current: 0,
				midButton: true,
				inactiveColor: 'rgba(178, 178, 178, 1)',
				activeColor: '#0863E8',
				contentStyle: {
					color: 'red',
					fontSize: '60px'
				},
				show: true,
				bgColor: '#fff',
				borderTop: true,
				list: [{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '首页',
						pagePath: "/pages/home/index",
						customIcon: false,
					},
					{
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '我的',
						isDot: false,
						customIcon: false,
						pagePath: "/pages/me/me",

					},
				],
				midButton: true,
				inactiveColor: 'rgba(178, 178, 178, 1)',
				activeColor: '#0863E8',
				outCheck: [{
						title: "见证取样管理",
						lists: [{
							index: 1,
							title: '现场见证取样',
							openType: 'navigate',
							routerPath: '/pages/apply/sampleManage/fieldSampling/testing/index',
							imgPath: '../../static/outCheck/01.png',
							width: "76upx",
							background: "rgba(116,185,255,0.6)",
							num: ""
						}, {
							title: '样品室内收样',
							index: 2,
							openType: 'navigate',
							routerPath: '/pages/apply/sampleManage/collection/testing/index',
							imgPath: '../../static/outCheck/02.png',
							width: "72upx",
							background: "rgba(177,188,239,0.6)",
							num: ""
						}, ]

					},
					{
						title: "试验检测管理",
						lists: [{
								index: 3,
								title: '不合格报告管理',
								openType: 'navigate',
								routerPath: '/pages/apply/testDetectionManage/unqualifiedReport/testing/index',
								imgPath: '../../static/outCheck/03.png',
								width: "76upx",
								background: "rgba(116,185,255,0.6)",
								num: ""
							},
							{
								index: 4,
								title: '材料报验单管理',
								openType: 'navigate',
								routerPath: '/pages/apply/testDetectionManage/InspectionForm/testing/index',
								imgPath: '../../static/outCheck/04.png',
								width: "76upx",
								background: "rgba(116,185,255,0.6)",
								num: ""
							},
						]
					},
					{
						title: "外委检测管理",
						lists: [{
							index: 5,
							title: '不合格报告管理',
							openType: 'navigate',
							routerPath: '/pages/apply/outsourcedManage/outUnQualifiedReports/testing/index',
							imgPath: '../../static/outCheck/05.png',
							width: "76upx",
							background: "rgba(116,185,255,0.6)",
							num: ""
						}]
					},
					{
						title: "智能养护管理",
						lists: [{
								index: 6,
								title: '试件入库管理',
								openType: 'navigate',
								routerPath: '/pages/apply/intelligentMaintenanceManage/sampleStorage/testing/index',
								imgPath: '../../static/outCheck/06.png',
								width: "76upx",
								background: "rgba(116,185,255,0.6)",
								num: ""
							},
							{
								title: '试件出库管理',
								index: 7,
								openType: 'navigate',
								routerPath: '/pages/apply/intelligentMaintenanceManage/sampleOutbound/testing/index',
								imgPath: '../../static/outCheck/07.png',
								width: "72upx",
								background: "rgba(177,188,239,0.6)",
								num: ""
							}
						]
					},
					{
						title: "回弹强度检测",
						lists: [
							// {
							// 	index: 8,
							// 	title: '回弹检测数据',
							// 	openType: 'navigate',
							// 	routerPath: '/pages/apply/reboundStrengthManage/reboundDetectionData/testing/index',
							// 	imgPath: '../../static/outCheck/08.png',
							// 	width: "76upx",
							// 	background: "rgba(116,185,255,0.6)",
							// 	num: ""
							// },
							{
								title: '不合格数据管理',
								index: 9,
								openType: 'navigate',
								routerPath: '/pages/apply/reboundStrengthManage/reboundUnqualifiedData/testing/index',
								imgPath: '../../static/outCheck/09.png',
								width: "72upx",
								background: "rgba(177,188,239,0.6)",
								num: ""
							}
						]
					},
					{
						title: "钢保厚度检测",
						lists: [
							// {
							// 	index: 10,
							// 	title: '钢保检测数据',
							// 	openType: 'navigate',
							// 	routerPath: '/pages/apply/rebarThicknessManage/rebarDetectionData/testing/index',
							// 	imgPath: '../../static/outCheck/10.png',
							// 	width: "76upx",
							// 	background: "rgba(116,185,255,0.6)",
							// 	num: ""
							// },
							{
								title: '不合格数据管理管理',
								index: 11,
								openType: 'navigate',
								routerPath: '/pages/apply/rebarThicknessManage/rebarUnqualifiedData/testing/index',
								imgPath: '../../static/outCheck/11.png',
								width: "72upx",
								background: "rgba(177,188,239,0.6)",
								num: ""
							}
						]
					},
					{
						title: "砼拌合生产质量管控",
						lists: [

							{
								title: '不合格数据管理管理',
								index: 12,
								openType: 'navigate',
								routerPath: '/pages/apply/HntManage/testing/index',
								imgPath: '../../static/outCheck/12.png',
								width: "72upx",
								background: "rgba(177,188,239,0.6)",
								num: ""
							}
						]
					},
					{
						title: "软基施工监管",
						lists: [{
							index: 15,
							title: '管控超标监控',
							openType: 'navigate',
							routerPath: '/pages/apply/softFoundationManage/overLimitMonitor/testing/index',
							imgPath: '../../static/outCheck/15.png',
							width: "76upx",
							background: "rgba(116,185,255,0.6)",
							num: ""
						}, ]
					},
					{
						title: "外业检测任务单",
						lists: [{
							index: 16,
							title: '回弹',
							openType: 'navigate',
							routerPath: '/pages/apply/fieldTestManage/fieldReboundDetection/testing/index',
							imgPath: '../../static/outCheck/16.png',
							width: "76upx",
							background: "rgba(116,185,255,0.6)",
							num: ""
						}, {
							title: '钢筋保护层',
							index: 17,
							openType: 'navigate',
							routerPath: '/pages/apply/fieldTestManage/fieldSteelProtection/testing/index',
							imgPath: '../../static/outCheck/17.png',
							width: "72upx",
							background: "rgba(177,188,239,0.6)",
							num: ""
						}, {
							title: '桩基',
							index: 18,
							openType: 'navigate',
							routerPath: '/pages/apply/fieldTestManage/fieldPilesDetectedData/testing/index',
							imgPath: '../../static/outCheck/18.png',
							width: "72upx",
							background: "rgba(177,188,239,0.6)",
							num: ""
						}, {
							title: '成孔质量',
							index: 19,
							openType: 'navigate',
							routerPath: '/pages/apply/fieldTestManage/fieldHoleDetectedData/testing/index',
							imgPath: '../../static/outCheck/19.png',
							width: "72upx",
							background: "rgba(177,188,239,0.6)",
							num: ""
						}, ]

					},

				],

			};
		},

		mounted() {
			this.getLocalData()
			var that = this
			uni.getStorage({
				key: 'userInfo',
				success: function(res) {
					that.userInfo = JSON.parse(res.data)

				}
			})

		},
		onLoad(options) {
			// console.log(88, options.Wechat)
			// this.Wechat=
			// Wechat
			// location.reload()
			// setInterval(() => {
			//     this.$router.go(0)
			// }, 500)
			this.getLocalData()

		},
		onHide() {

			// this.getLocalData()
		},


		onTabItemTap(e) {
			// tab 点击时执行，此处直接接收单击事件
			this.getLocalData()
		},
		components: {
			uTabbar,
			nCollapse,

		},
		onShow() {

			var that = this
			this.getLocalData()
			let curPage = this.getCurPage();
			// console.log(1, curPage)
			//在微信小程序或是app中，通过curPage.options；如果是H5，则需要curPage.$route.query（H5中的curPage.options为undefined，所以刚好就不需要条件编译了）
			let curParam = curPage.options || curPage.$route.query;
			this.Wechat = curParam.Wechat
			// console.log(2, curParam.Wechat)
		},
		methods: {
			getCurPage() {
				//获取全部页面实例
				let pages = getCurrentPages();
				// console.log('路由1', pages)
				// alert(pages)
				//获取本页面的实例
				let curPage = pages[pages.length - 1];
				//console.log('路由2',curPage.$route.query)
				// alert(curPage)
				return curPage
			},

			change(e) {
				this.getLocalData()
			},
			ontabtap(e) {

				let index = e.target.dataset.current || e.currentTarget.dataset.current;
				this.getLocalData()
				this.switchTab(index);
			},
			ontabchange(e) {
				let index = e.target.current || e.detail.current;
				this.switchTab(index);
			},
			switchTab(index) {
				this.getLocalData()
				// this.outCheck[0].lists[0].num = 33;
				// if (index == 2) {
				// 	uni.showToast({
				// 		title: "模块暂未开放"
				// 	})
				// 	return false
				// } else {
				if (this.tabIndex === index) {
					return;
				}



				this.tabIndex = index;
				this.scrollInto = this.tabBars[index].id;
				// }
			},
			shows(e) {

			},
			hide(e) {

			},
			clickHandler(e) {

			},
			getLocalData() {
				var that = this

				uni.getStorage({
					key: 'userInfo',
					success: function(res) {
						that.userInfo = JSON.parse(res.data)
						// that.companyId = that.userInfo.companyId

						// that.getListData(JSON.parse(res.data))
					}
				})

				uni.getStorage({
					key: 'role',
					success: function(res) {
						that.role = JSON.parse(res.data)
						// console.log(that.role)
						// that.role=[ "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"]
					}
				})
				// uni.getStorage({
				// 	key: 'companyTree',
				// 	success: function(res) {

				// 		that.companyTree = JSON.parse(res.data)

				// 	}
				// })

			},
			callback() {},
			getListData(data) {
				var that = this

				var datas = {
					userId: data.userId,
					modelType: 0,
					companyId: data.companyId,
					departmentCode: data.departmentCode
				}

				this.$http.getBack(datas).then(res => {
					if (res.errcode == 0) {

						var OutCheckCount = res.data.OutCheckCount //备案待办
						that.outCheck[0].lists[0].num = OutCheckCount[0]
						that.outCheck[0].lists[1].num = OutCheckCount[1]
						that.outCheck[0].lists[2].num = OutCheckCount[2]
						that.outCheck[0].lists[3].num = OutCheckCount[3]
						var outCheckCount2 = res.data.outCheckCount2 //通知待办
						that.outCheck[1].lists[0].num = outCheckCount2[0]
						that.outCheck[1].lists[1].num = outCheckCount2[1]
						that.outCheck[1].lists[2].num = outCheckCount2[2]
						var outCheckCount3 = res.data.outCheckCount3 // 【外检】方案报审待办
						that.outCheck[2].lists[0].num = outCheckCount3[0]
						that.outCheck[2].lists[1].num = outCheckCount3[1]
						that.outCheck[2].lists[2].num = outCheckCount3[2]
						that.outCheck[2].lists[3].num = outCheckCount3[3]
						var outCheckCount4 = res.data.outCheckCount4 // 【外检】检测报告待办
						that.outCheck[3].lists[0].num = outCheckCount4[0]
						that.outCheck[3].lists[1].num = outCheckCount4[1]
						that.outCheck[3].lists[2].num = outCheckCount4[2]
						that.outCheck[3].lists[3].num = outCheckCount4[3]
						that.outCheck[3].lists[4].num = outCheckCount4[4]
						var supervisionCount = res.data.supervisionCount //监督检查】评价待办

						that.examineData[0].lists[0].num = supervisionCount[0]
						that.examineData[0].lists[1].num = supervisionCount[1]
						var supernotiCount = res.data.supernotiCount //监督检查】情况及整改待办
						that.examineData[1].lists[0].num = supernotiCount[0]
						that.examineData[1].lists[1].num = supernotiCount[1]
						that.examineData[1].lists[2].num = supernotiCount[2]
						that.examineData[1].lists[3].num = supernotiCount[3]
						var equipdeployCount = res.data.equipdeployCount //设备】调配待办
						that.equipment[0].lists[0].num = equipdeployCount[0]
						that.equipment[0].lists[1].num = equipdeployCount[1]
						that.equipment[0].lists[2].num = equipdeployCount[2]
						that.equipment[0].lists[3].num = equipdeployCount[3]
						var equipcheckformCount = res.data.equipcheckformCount //设备】检定校准待办
						that.equipment[1].lists[0].num = equipcheckformCount[0]
						that.equipment[1].lists[1].num = equipcheckformCount[1]
						that.equipment[1].lists[2].num = equipcheckformCount[3]
						that.equipment[1].lists[3].num = equipcheckformCount[2]
						var equipduringformCount = res.data.equipduringformCount //设备】期间核查待办
						that.equipment[3].lists[0].num = equipduringformCount[0]
						that.equipment[3].lists[1].num = equipduringformCount[1]

						var equiphandleformCount = res.data.equiphandleformCount
						that.equipment[4].lists[0].num = equiphandleformCount[0]
						that.equipment[4].lists[1].num = equiphandleformCount[1]
						that.equipment[4].lists[2].num = equiphandleformCount[2]
						that.equipment[4].lists[3].num = equiphandleformCount[3]
						that.equipment[4].lists[4].num = equiphandleformCount[4]
						that.equipment[4].lists[5].num = equiphandleformCount[5]
						that.equipment[4].lists[6].num = equiphandleformCount[6]

					} else {
						console.log("接口报错")
					}
				}, (err) => {
					uni.showToast({
						title: "获取数据失败",
						icon: 'none',
						duration: 2000
					});
				})

			},

			getListDatas(id) {
				var that = this


			},

			skipOperation(url, index) {
				// console.log(this.role, index)
				uni.navigateTo({
					url: url
				});
				// this.role.map(item=>{
				// 	if(item==index){
				// 		if (index == 6 || index == 4 || index == 5) {
				// 			var path;
				// 			if (index == 4) {
				// 				path = "http://wechat.sccttd.com/dist/#/index?openid="+this.Wechat
				// 			} else if (index == 5) {
				// 				path = "http://wechat.sccttd.com/distYJLQ/#/index?openid="+this.Wechat
				// 			} else if (index == 6) {
				// 				path = "http://wechat.sccttd.com/distYJWater/#/index?openid="+this.Wechat
				// 			}
				// 			// 以百度url为例子，具体填写你自己要跳转的链接 
				// 			uni.navigateTo({
				// 				url: '/pages/webview/webview?url=' + path
				// 				// page.json定义的路径 传url到webview界面去接收-实现跳转
				// 			})
				// 		} else {
				// 			var that = this
				// 			uni.navigateTo({
				// 				url: url
				// 			});
				// 		}
				// 	}else {
				// 		uni.showToast({
				// 			title: "暂无权限",
				// 			icon: 'none',
				// 			duration: 2000
				// 		});
				// 	}
				// })




			}


		}
	};
</script>
<style scope lang="less">
	.apply {
		overflow: hidden;
		display: flex;

		flex-direction: column;

		height: calc(100% - 50px);

		.applytitle {
			height: 200upx;
			line-height: 250upx;
			font-size: 34upx;
		}

	}


	.topTexts {
		height: 120upx;
		background: #3476DB;
		text-align: center;
		line-height: 120upx;
		font-size: 36upx;
		font-weight: 700 !important;
		letter-spacing: 4upx;
		font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
			"Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, Simsun, sans-serif;
	}

	.applyTop {
		height: 360rpx;
		background: url("../../static/index/vn.png");
		background-size: 100% 100%;
		font-size: 36upx;
		letter-spacing: 6upx;
		line-height: 370upx;
		text-shadow: 6upx 4upx 4upx rgba(0, 0, 0, 0.3);
		font-weight: 700;
		color: #fff;
		text-align: center;
	}



	.contentModule {
		display: flex;
		position: relative;
		margin-bottom: 30upx;
		width: 25%;
		display: flex;
		justify-content: center;

		.imgbox {
			color: #171A1D;
			font-size: 28upx;
			text-align: center;
			position: relative;

			image {
				width: 116upx;
				height: 96upx;
				padding: 0;
				box-sizing: border-box;
			}



		}

		.title {
			width: 100%;
			color: #666666;
			letter-spacing: 2upx;
			margin-top: 20upx;
		}


	}



	.pageText {
		width: 750upx;
		height: 100upx;
		position: absolute;
		box-sizing: border-box;
		margin: auto;
		margin-top: 300upx;
		display: flex;
		justify-content: center;

		.pageTitle {
			text-align: center;
			height: 100upx;
			line-height: 100upx;
			border-radius: 8px;
			font-weight: 700;
			background-color: #fff;
			width: 95%;
			color: #171A1D;
			font-size: 40upx;
			border-bottom: 2upx solid #ECECEE;
			letter-spacing: 2upx;
			display: flex;
			align-items: center;
			padding: 0 40upx;

			.personLogo {
				width: 88upx;
				height: 88upx;
				margin-right: 24upx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.userInfo {
				display: flex;

				.name {
					font-size: 30upx;
					color: #171A1D;
					margin-right: 32upx;
				}

				.company {
					font-size: 24upx;
					color: #171A1D;
				}
			}
		}
	}



	.test {
		padding: 32rpx;
	}

	.tabs {
		flex: 1;
		flex-direction: column;
		overflow: hidden;
		/* background-color: #ffffff; */
		/* #ifndef APP-PLUS */
		height: 100vh;
		/* #endif */

	}

	.scroll-hs {
		width: 750rpx;

		// width: 100%;

		height: 100rpx;
		line-height: 100rpx;
		flex-direction: row;

		white-space: nowrap;
		background-color: #fff;

	}

	.line-h {
		height: 1rpx;
		background-color: #cccccc;
	}

	.uni-tab-item {
		// width: 100upx;
		/* #ifndef APP-PLUS */
		display: inline-block;
		/* #endif */
		flex-wrap: nowrap;
		display: inline-block;
		padding-left: 34rpx;
		padding-right: 34rpx;
		height: 100upx;
	}

	.uni-tab-item-title {
		color: #B2B2B2;
		font-size: 30rpx;
		/* height: 100rpx; */
		/* line-height: 80rpx; */
		flex-wrap: nowrap;
		/* #ifndef APP-PLUS */
		white-space: nowrap;
		height: 92upx !important;
		/* #endif */

	}

	.uni-tab-item-title span {
		display: inline-block;
		height: 92upx !important;
	}

	.uni-tab-item-title-active {
		color: #0863E8;
		/* border-bottom: 4px solid #525EF9; */

	}

	.swiper-boxs {

		margin-top: 30upx;
		// height: 350px;
		height: calc(100vh - 550upx)
	}

	.swiper-item {
		// flex: 1;
		// flex-direction: row;
	}

	.scroll-v {
		flex: 1;
		/* #ifndef MP-ALIPAY */
		flex-direction: column;
		/* #endif */
		width: 750rpx;
		width: 100%;
	}

	.skipOpera {
		position: relative;
		text-align: center;
		display: flex;
		flex-direction: column;
		align-items: center;

	}

	.module {
		width: 686upx;

		margin: 0 auto 30upx;
		padding: 15upx 0 0;
		background-color: #fff;
		border-radius: 8upx;

	}

	.itemTitle {
		height: 60upx;
		line-height: 60upx;
		font-size: 36upx;
		padding: 0 20upx;
		color: #171A1D;
		font-weight: 700;
		letter-spacing: 2upx;
	}

	.iconNum {
		// width: 40upx;
		// height: 40upx;
		background-color: red;
		position: absolute;
		padding: 7upx;
		top: -20upx;
		right: -10upx;
		// z-index: 555;
		border-radius: 50%;
		color: #fff;

	}
</style>
